import React, { Component } from 'react';
import { StyleSheet, Text, Animated, View, Image, TouchableOpacity } from "react-native";
import { GLOBAL } from '../../../config/global';
import { style } from '../../../theme/style';
const scale = GLOBAL.SCALE;


export class ApplyBottomcCard extends Component {
	constructor(props) {
		super(props);
		this.state = {
			data: {},
		}
		this.onOff = true;
	}

	componentWillReceiveProps(props) {
		const { data } = props;
		this.setState({
			data
		})
	}

	componentWillMount() {
		const { data } = this.props;
		this.setState({
			data
		})
	}


	render() {
		let { method } = this.props;
		let { refused, agree } = method || {};
		return (
			<View style={styles.container}>
				<View style={styles.btnBox}>
					<TouchableOpacity onPress={() => { agree && agree() }} style={[styles.btnClick, styles.btnClickActive]}>
						<Text style={styles.btnText}>同意</Text>
					</TouchableOpacity>
					<TouchableOpacity onPress={() => { refused && refused() }} style={styles.btnClick}>
						<Text style={[styles.btnText, styles.btnActive]}>驳回</Text>
					</TouchableOpacity>
				</View>
			</View>
		)
	}
}

const styles = StyleSheet.create({
	container: {
		height: 60 * scale,
		width: '100%',
		backgroundColor: "#fff",
		flexDirection: 'row',
		justifyContent: 'flex-end'
	},
	selectBox: {
		flexDirection: 'row',
		justifyContent: 'center',
		alignItems: 'center',
		paddingLeft: 20 * scale
	},
	btnBox: {
		flexDirection: 'row',
		justifyContent: 'flex-end',
		alignItems: 'center',
		paddingRight: 20 * scale
	},
	btnClick: {
		backgroundColor: '#fff',
		height: 30 * scale,
		width: 78 * scale,
		borderRadius: 15 * scale,
		marginLeft: 10 * scale,
		borderWidth: 1 * scale,
		borderColor: style.color.themeColor,
		flexDirection: 'row',
		justifyContent: 'center',
		alignItems: 'center',
	},
	btnClickActive: {
		backgroundColor: style.color.themeColor,
		borderWidth: 1 * scale,
		borderColor: style.color.themeColor,
	},
	btnActive: {
		color: style.color.themeColor
	},
	btnText: {
		color: '#fff'
	}
})
